<?php
    include("html_header.html");
//include("html_footer.html");
?>
    <script>
        $(document).ready(function () {

//            $("#mainForm>header").hide();

            $("#btn_clear").click(function (event) {
                event.preventDefault();

                $("#input_user_passwd").val("");
                uname = $("#input_user_name");
                uname.val("");
                uname.focus();
            });

//            提交处理
            $("#btn_submit").click(function (event) {
                event.preventDefault();
//                alert("正在提交");
                $.post("user_add.php",
                    $("#mainForm").serialize(),
                    function (data) {

                        $("#div_result>p").detach();
                        divRe = $("#div_result");
                        divRe.hide();
                        divRe.append("<p>" + data + "</p>");
                        divRe.addClass("container");
                        divRe.fadeIn("slow");
                    });
            });
        });
    </script>
    <div id="mainContainer">

        <div class="container">
            <h1>用户注册</h1>
        </div>
        <div class="clear"></div>
        <div class="container">
            <ul>
                <li><a href='index.php'>首页</a></li>
                <li><a href='user_list.php'>用户列表</a></li>
            </ul>
        </div>
        <div class="clear"></div>
        <div class="container">
            <form id="mainForm" class="mainTable">
                <header>注册用户</header>
                昵称:<input id="input_user_name" type="text" name="user_name" autofocus="autofocus"/><br>
                密码:<input id="input_user_passwd" type="text" name="user_passwd"/><br>
                <input id="btn_submit" type="button" value="注册"/>
                <input id="btn_clear" type="button" value="清空"/>
            </form>
        </div>
        <div class="clear"></div>
        <div id="div_result"></div>
    </div>
<?php
//include("html_header.html");
    include("html_footer.html");
?>